package MyArray;

import java.util.HashMap;
import java.util.Map;

public class MyArrayUtils {
    /**
     * 打印数组
     * @param ints
     */
    public static void print(int[] ints){
        for (int i = 0; i <ints.length ; i++) {
            System.out.print(i);

        }
            System.out.println();
        for (int i = 0; i <ints.length ; i++) {

            System.out.print(ints[i]);
        }
        System.out.println();

    }

    /**
     * 根据值找索引
     * 复杂度 o(n)
     * @param ints
     * @param value
     * @return
     */
    public static  void findIndexByValue(int[] ints,int value){
        for (int i = 0; i <ints.length ; i++) {
            if(ints[i]==value){
                System.out.println(i);
            }
        }

    }


    public static void main(String[] args) {
        int[] ints = new int[10];
        ints[0]=1;
        ints[1]=2;
        ints[2]=3;
        ints[3]=1;
        ints[4]=2;
        ints[5]=3;
        ints[6]=1;
        ints[7]=2;
        ints[8]=3;


        print(ints);
       findIndexByValue(ints,2);
    }


}
